package cn.wokoba.dao.mapper;



import cn.wokoba.dao.pojo.RaffleActivitySku;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

//商品sku
@Mapper
public interface RaffleActivitySkuMapper extends BaseMapper<RaffleActivitySku> {

    @Update("""
            update raffle_activity_sku
                    set stock_count_surplus = stock_count_surplus - 1, update_time = now()
                    where sku = #{sku} and stock_count_surplus > 0""")
    void updateActivitySkuStock(Long sku);
    @Update("""
            update raffle_activity_sku
                    set stock_count_surplus = 0, update_time = now()
                    where sku = #{sku}""")
    void clearActivitySkuStock(Long sku);
}
